downloadExl(json, type) {
    var tmpdata = json[0];
    json.unshift({});
    var keyMap = []; //获取keys
    for (var k in tmpdata) {
      keyMap.push(k);
      json[0][k] = k;
    }
    var tmpdata = []; //用来保存转换好的json
    json
      .map((v, i) =>
        keyMap.map((k, j) =>
          Object.assign(
            {},
            {
              v: v[k],
              position:
                (j > 25 ? this.getCharCol(j) : String.fromCharCode(65 + j)) +
                (i + 1),
            }
          )
        )
      )
      .reduce((prev, next) => prev.concat(next))
      .forEach(
        (v, i) =>
          (tmpdata[v.position] = {
            v: v.v,
          })
      );

    var outputPos = Object.keys(tmpdata); //设置区域,比如表格从A1到D10
    console.log(tmpdata);

    tmpdata["!merges"] = style.merges; //设置单元格合并
    tmpdata["A1"].s = style.title;
    tmpdata["A4"].s = tmpdata["B4"].s = tmpdata["D4"].s = tmpdata["E4"].s =
      style.font1;
    tmpdata["A5"].s = tmpdata["F5"].s = tmpdata["K5"].s = style.font2;
    tmpdata["A7"].s = tmpdata["B7"].s = tmpdata["C7"].s = tmpdata[
      "D7"
    ].s = tmpdata["E7"].s = style.font3;
    var tmpWB = {
      SheetNames: ["加班餐费的具体加班几天名单"], //保存的表标题
      Sheets: {
        加班餐费的具体加班几天名单: Object.assign(
          {},
          tmpdata, //内容
          {
            "!ref": outputPos[0] + ":" + outputPos[outputPos.length - 1], //设置填充区域
          }
        ),
      },
    };
    var tmpDown = new Blob(
      [
        s2ab(
          XLSXStyle.write(
            tmpWB,
            {
              bookType: type == undefined ? "xlsx" : type,
              bookSST: false,
              type: "binary",
            } //这里的数据是用来定义导出的格式类型
          )
        ),
      ],
      {
        type: "",
      }
    );
    this.saveAs(
      tmpDown,
      this.invoce_data.project_name +
        "." +
        (this.wopts.bookType == "biff2" ? "xls" : this.wopts.bookType)
    );
  }
  getCharCol(n) {
    (s = ""), (m = 0);
    while (n > 0) {
      m = (n % 26) + 1;
      s = String.fromCharCode(m + 64) + s;
      n = (n - m) / 26;
    }
    return s;
  }
  s2ab(s) {
    if (typeof ArrayBuffer !== "undefined") {
      var buf = new ArrayBuffer(s.length);
      var view = new Uint8Array(buf);
      for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xff;
      return buf;
    } else {
      var buf = new Array(s.length);
      for (var i = 0; i != s.length; ++i) buf[i] = s.charCodeAt(i) & 0xff;
      return buf;
    }
  }
  saveAs(obj, fileName) {
    var tmpa = document.createElement("a");
    tmpa.download = fileName || "下载";
    tmpa.href = URL.createObjectURL(obj);
    tmpa.click();
    setTimeout(function () {
      URL.revokeObjectURL(obj);
    }, 100);
  }